package watki.tylko;

public class SwinkiTrzy implements Runnable {

	@Override
	public void run() {

		if("Muzyka".equals(Thread.currentThread().getName()))
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
			}
		String nazwa = Thread.currentThread().getName();
		for (int i = 0; i < 10; i++) {
			System.out.println(nazwa);
		}
	}

	public static void main(String[] args) {

		Runnable r = new SwinkiTrzy();
		Thread t1 = new Thread(r);
		Thread t2 = new Thread(r);
		Thread t3 = new Thread(r);
		t1.setName("Sport");
		t2.setName("Muzyka");
		t3.setName("Gry");
		t1.start();
		t2.start();
		t3.start();
	}

}
